chore: replace depcheck with knip - #330
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
c6ce5d5 to
8e8ab88
Compare
8e8ab88 to
0fa1ca9
Compare
0fa1ca9 to
e6b288c
Compare
e6b288c to
483699b
Compare
483699b to
9409f44
Compare
The merge-base changed after approval.
9409f44 to
c5dcd6a
Compare
c5dcd6a to
17da708
Compare
Core dropped depcheck for knip, so match it. depcheck ^1.4.7 removed, along with .depcheckrc.json knip ^6.23.0 added, with knip.config.mts Scripts follow core's shape: lint:dependencies bakes in `yarn dedupe --check` and a separate lint:dependencies:fix runs the writing form, rather than passing --check through from `lint`. The config is nine lines rather than core's 292, because that file is almost entirely per workspace tuning for a monorepo and this is a single package. Only the two lavamoat packages need ignoring: both are wired in through the Yarn plugin and the lavamoat.allowScripts field rather than imported, so knip cannot see the usage. Switching also turned up dead weight that depcheck had been hiding. Its ignore list included ts-node, which nothing references: it is not a peer of ts-jest, appears nowhere outside its own package.json entry, and core does not carry it. Removed rather than re-ignored. knip requires Node ^20.19.0 || >=22.12.0. Only the Lint job runs it, and that job is pinned to 22.x, so this is safe ahead of the Node floor bump.
17da708 to
9cecd71
Compare
Core dropped
depcheckforknip, so match it. Sits below the Node bump so it lands with the rest of the tooling alignment.depcheck@^1.4.7+.depcheckrc.jsonknip@^6.23.0+knip.config.mtsScripts follow core's shape:
lint:dependenciesbakes inyarn dedupe --check, with a separatelint:dependencies:fixfor the writing form, rather than threading--checkthrough fromlint.Config is nine lines, not core's 292
Core's
knip.config.mtsis almost entirely per-workspace tuning for a monorepo. This is a single package, so it needs an entry pair and two ignores:Both lavamoat packages are wired in through the Yarn plugin and the
lavamoat.allowScriptsfield rather than imported, so knip can't see the usage.It found dead weight depcheck was hiding
The old
.depcheckrc.jsonignore list includedts-node. Nothing references it: it isn't a peer ofts-jest, appears nowhere outside its ownpackage.jsonentry, and core doesn't carry it. Removed rather than re-ignored.Node requirement
knip needs
^20.19.0 || >=22.12.0. Only the Lint job runs it and that job is pinned to22.x, so this is safe ahead of the Node floor bump in the next PR.Note
Low Risk
Tooling-only change to dependency linting; no runtime or library API changes.
Overview
Replaces depcheck and
.depcheckrc.jsonwith knip and a smallknip.config.mtsthat scopes analysis tosrc/index.ts,src/node.ts, andsrc/**/*.ts, while ignoring Lavamoat packages that are referenced only via Yarn/Lavamoat config.Lint scripts now run
knip --dependenciesplusyarn dedupe --checkunderlint:dependencies, with a newlint:dependencies:fix(andlint:fixwired to it) that runs dedupe without--check.Dev dependencies: adds
knip@^6.23.0, removesdepcheckand unusedts-node(previously on depcheck’s ignore list). Lockfile updates reflect knip’s dependency tree and shed depcheck/ts-node transitives.Reviewed by Cursor Bugbot for commit 9cecd71. Bugbot is set up for automated code reviews on this repo. Configure here.